package com.qersoft.controller;

import com.qersoft.entity.ResponseMessage;
import com.qersoft.entity.userAnswer;
import com.qersoft.service.ScoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@Slf4j
@RestController
@RequestMapping("takeIn")
public class UserAnswerControllor {
    @Autowired
    private ScoreService scoreService;

    @PostMapping("/score")
    public ResponseMessage<ArrayList<Integer>> takeIn(@RequestBody ArrayList<userAnswer> userAnswers) {
        return ResponseMessage.message(scoreService.result(userAnswers));
    }
}
